package ch03_程序流程控制;

public class Ch3_7 {
	public static void main(String[] args) {
		double PI=0,item=1;
		int sign=1;
		int deno=1;
		while(Math.abs(item)>1e-6) {
			PI+=item;
			deno+=2;
			sign*=-1;
			item=sign*1.0/deno;
		}
		PI=PI*4;
		System.out.print("PI ="+PI +"满足要求的最后一项=");
		System.out.println((-sign)+"/"+(deno-2));
	}
}